APT Usage
annotation-processor Module
Java APT is based on annotation processors. This project example only outputs some print content.
Writing a Processor
If you want to learn more about annotation processors, please read Core-Java-Vol.-II-Advanced-Features-12th-Edition-Cay-S.-Horstmann.
How to Use Processor JAR Package in Other Projects
- maven
- gradle
<!--...-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>com.whalefall</groupId>
<artifactId>annotation-processor</artifactId>
<version>0.0.1-SNAPSHOT</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
</path>
</annotationProcessorPaths>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<!--...Here are include lombok, thus I use the plugin.-->
dependencies {
// ...
annotationProcessor 'com.whalefall:annotation-processor:0.0.1-SNAPSHOT'
testAnnotationProcessor 'com.whalefall:annotation-processor:0.0.1-SNAPSHOT'
// if you are using processor in test code
// if you use this in other module of the aggregation project
annotationProcessor project(':annotation-processor')
}